//
//  DataPersist.h
//  ORMedia aiden
//
//  Created by Mac on 2018/7/28.
//  Copyright © 2018年 Mac. All rights reserved.
//

#import "DataPersist.h"

@implementation DataPersist
+(void)writeValuePre:(NSString*)value key:(NSString*)key{
    // 1 实例化 2 key value (nsnumber)3 同步
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:value forKey:key];
    [defaults synchronize];
}
+(NSString *)readValuePre:(NSString*)key{
    // 1 实例化 2 value 3 return
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *value = [defaults objectForKey:key];
    return value;
}

//NSMutableArray
+(void)writeValueNSMutableArray:(NSMutableArray*)value key:(NSString*)key{
    // 1 实例化 2 key value (nsnumber)3 同步
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:value forKey:key];
    [defaults synchronize];
}
+(NSMutableArray *)readValueNSMutableArray:(NSString*)key{
    // 1 实例化 2 value 3 return
    //读取数组值
//    NSMutableArray* MACArray = [userDefaults objectForKey:@"MACArray"];
//    NSLog(@"MACArray value is:%@",MACArray);
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSMutableArray *value = [defaults objectForKey:key];
    return value;
}

//NSMutableDictionary
+(void)writeValueNSMutableDictionary:(NSMutableDictionary*)value key:(NSString*)key{
    // 1 实例化 2 key value (nsnumber)3 同步
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:value forKey:key];
    [defaults synchronize];
}
+(NSMutableDictionary *)readValueNSMutableDictionary:(NSString*)key{
    // 1 实例化 2 value 3 return
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSMutableDictionary *value = [defaults objectForKey:key];
    return value;
}
@end
